package com.neusoft.Controller;

import com.neusoft.po.Emp;
import com.neusoft.po.ResponseBean;
import com.neusoft.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/emp")
@RefreshScope   // 开启动态刷新
public class EmpController {
    @Autowired
    private EmpService es;

    @Value("${msg}")
    private String msg;

    @GetMapping("/getEmpByNo/{empno}")
    ResponseBean<Emp> getEmpByNo(@PathVariable Integer empno){
        ResponseBean<Emp> empByNo = es.getEmpByNo(empno);
        empByNo.setMsg(msg);
        return empByNo;
    }
}
